import os.path

comfyui_output = 'C:\\Users\\cbs2\\Desktop\\ComfyUI_windows_portable\\ComfyUI\\output\\'
base_url = 'http://10.31.120.162:8189/'
comfyui_upload = f'{base_url}upload/image'
websocket_url = 'ws://10.31.120.162:8189/ws'

root = os.getcwd()
source_dir = 'source'
# 视频文件路径
video_relate_path = f'{source_dir}\\source.mp4'
srt_relate_path = f'{source_dir}\\歌词.srt'
# 图片输出目录
frames_relate_dir = f'{source_dir}\\frames\\'

# 当前项目id
cur_workflows_id = '123'

# 项目相关目录
workflows_dir = f'{os.path.dirname(root)}\\ai_video_Data\\workplaces\\'
workflows_json = 'storyboards.json'
config_json = 'config.json'
prompt_config_json = 'prompt_config_json.json'
workflows_img_dir = 'image_temps'
workflows_svd_dir = 'svd_videos'

if not os.path.exists(workflows_dir):
    os.makedirs(workflows_dir)


def set_cur_project(name):
    global cur_workflows_id
    cur_workflows_id = name


def get_cur_project():
    return cur_workflows_id


# 素材视频路径 source.mp4
def get_video_path():
    path = f"{workflows_dir}{cur_workflows_id}\\{video_relate_path}"
    if not os.path.exists(f"{workflows_dir}{cur_workflows_id}\\{source_dir}"):
        os.mkdir(f"{workflows_dir}{cur_workflows_id}\\{source_dir}")
    return path


# 儿歌-加油鸭.srt
def get_srt_path():
    path = f"{workflows_dir}{cur_workflows_id}\\{srt_relate_path}"
    if not os.path.exists(f"{workflows_dir}{cur_workflows_id}\\{source_dir}"):
        os.mkdir(f"{workflows_dir}{cur_workflows_id}\\{source_dir}")
    return path


# frames
def get_frames_path():
    path = f"{workflows_dir}{cur_workflows_id}\\{frames_relate_dir}"
    if not os.path.exists(path):
        os.mkdir(path)
    return path


def get_storyboards_path():
    workflow_path = f'{workflows_dir}{cur_workflows_id}\\'
    storyboards_path = f'{workflow_path}{workflows_json}'
    if not os.path.exists(workflow_path):
        os.mkdir(workflow_path)
    return storyboards_path


# 生成的图片路径
def get_workflows_img_dir():
    workflow_path = f'{workflows_dir}{cur_workflows_id}\\'
    path = f'{workflow_path}{workflows_img_dir}'
    if not os.path.exists(workflow_path):
        os.mkdir(workflow_path)
    if not os.path.exists(path):
        os.mkdir(path)
    return path


# 生成的svd视频路径
def get_workflows_svd_dir():
    workflow_path = f'{workflows_dir}{cur_workflows_id}\\'
    path = f'{workflow_path}{workflows_svd_dir}'
    if not os.path.exists(workflow_path):
        os.mkdir(workflow_path)
    if not os.path.exists(path):
        os.mkdir(path)
    return path


def get_config_json():
    workflow_path = f'{workflows_dir}{cur_workflows_id}\\'
    config_json_path = f'{workflow_path}{config_json}'
    if not os.path.exists(workflow_path):
        os.mkdir(workflow_path)
    return config_json_path

# 项目质量提示词配置路径
def promot_config_path():
    workflow_path = f'{workflows_dir}{cur_workflows_id}\\'
    path = f'{workflow_path}{prompt_config_json}'
    if not os.path.exists(workflow_path):
        os.mkdir(workflow_path)
    return path